<%@ page import="myexchange.Player" %>



<div class="fieldcontain ${hasErrors(bean: playerInstance, field: 'userName', 'error')} required">
	<label for="userName">
		<g:message code="player.userName.label" default="User Name" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="userName" required="" value="${playerInstance?.userName}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: playerInstance, field: 'firstName', 'error')} required">
	<label for="firstName">
		<g:message code="player.firstName.label" default="First Name" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="firstName" required="" value="${playerInstance?.firstName}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: playerInstance, field: 'lastName', 'error')} required">
	<label for="lastName">
		<g:message code="player.lastName.label" default="Last Name" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="lastName" required="" value="${playerInstance?.lastName}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: playerInstance, field: 'cash', 'error')} required">
	<label for="cash">
		<g:message code="player.cash.label" default="Cash" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="number" name="cash" min="0" required="" value="${fieldValue(bean: playerInstance, field: 'cash')}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: playerInstance, field: 'cards', 'error')} ">
	<label for="cards">
		<g:message code="player.cards.label" default="Cards" />
		
	</label>
	<g:select name="cards" from="${myexchange.Card.list()}" multiple="multiple" optionKey="id" size="5" value="${playerInstance?.cards*.id}" class="many-to-many"/>
</div>

<div class="fieldcontain ${hasErrors(bean: playerInstance, field: 'nickname', 'error')} ">
	<label for="nickname">
		<g:message code="player.nickname.label" default="Nickname" />
		
	</label>
	<g:textField name="nickname" value="${playerInstance?.nickname}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: playerInstance, field: 'shares', 'error')} ">
	<label for="shares">
		<g:message code="player.shares.label" default="Shares" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${playerInstance?.shares?}" var="s">
    <li><g:link controller="exchange" action="show" id="${s.id}">${s?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="exchange" action="create" params="['player.id': playerInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'exchange.label', default: 'Exchange')])}</g:link>
</li>
</ul>

</div>

